package lc.com.pcsc;

import lc.com.pcsc.model.DataUnit;

/**
 * Created by Japhy on 2017-9-1.
 */

public class LibPcsc {
    static {
        System.loadLibrary("libpcsc");
    }

    public static int slotId(int slot) {
        return native_slot(slot);
    }
    public static int init(){
        return native_init();
    }
    public static int powerOn(String name){
        DataUnit atr = new DataUnit(64);
        return native_poweron(name, atr);
    }
    public static int powerOn(String name, DataUnit atr) {
        return native_poweron(name, atr);
    }
    public static int APDU(DataUnit capdu, DataUnit rapdu){
        return native_apdu(capdu, rapdu);
    }
    public static int powerOff(){
        return native_poweroff();
    }
    public static int isCardPresent(String name){
        return native_isCardPresent(name);
    }
    public static String APDUAscii(String capdu){return native_apdu_ascii(capdu);}

    private static native int native_slot(int slot);
    private static native int native_init();
    private static native int native_poweron(String name, DataUnit atr);
    private static native int native_apdu(DataUnit capdu, DataUnit rapdu);
    private static native String native_apdu_ascii(String capdu);
    private static native int native_poweroff();
    private static native int native_isCardPresent(String name);


    public native void TripleDes_Encryption(byte[] text,byte[] key);

    public native void TripleDes_Decryption(byte[] text,byte[] key);
}
